<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"/>
    <title>长乐美食城</title>
    <link rel="stylesheet" type="text/css" href="/Public/assets/home/images/favicon.ico">
    <link rel="stylesheet" type="text/css" href="/Public/vendor/slick/slick.css"/>
    <link rel="stylesheet" type="text/css" href="/Public/vendor/font-awesome/css/font-awesome.css"/>
    <link rel="stylesheet" type="text/css" href="/Public/assets/home/css/common.css"/>
    
</head>
<body>

<div class="logo">
    <h1><a href="index.html"><img class="img-responsive" src="/Public/assets/home/images/favicon.ico"
                                  alt="长乐美食城"/></a></h1>
    <h3>长乐美食城</h3>

    <div class="clears"></div>
</div>


    <div class="clearsH"></div>
    <div class="all">
        <ul class="menu">
            <li><a href="javascript:void(0);">全部商品</a></li>
            <li><a href="javascript:void(0);" id="list"><i class="fa fa-th"></i></a></li>
        </ul>
    </div>

    <div class="products">
        <?php if(is_array($all_products)): $i = 0; $__LIST__ = $all_products;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$all): $mod = ($i % 2 );++$i;?><dl>
                <dt><a href="<?php echo U('show',['id'=>$all['id']]);?>"><img class="img-responsive"
                                                                     src="<?php echo ($all["thumb"]); ?>"
                                                                     alt="<?php echo ($all["name"]); ?>"
                                                                     style="width: 152px;height: 92px;"/></a></dt>
                <dd><a href="<?php echo U('show',['id'=>$all['id']]);?>"><?php echo ($all["name"]); ?></a></dd>
                <dd>¥ <?php echo ($all["price"]); ?>元</dd>
            </dl><?php endforeach; endif; else: echo "" ;endif; ?>
        <div class="clears"></div>
    </div>
    <div class="perspective" id="loadMore">
        <span class="more">查看更多</span>
    </div>


<?php if(($product_num) > "0"): ?><a href="<?php echo U('Cart/index');?>" id="btn-cart"><i class="fa fa-shopping-cart"></i><span><?php echo ($product_num); ?></span></a><?php endif; ?>
<a href="javascript:;" id="to_top" onclick="goTop();return false;">返回</a>

<div class="footer">
    <p>
        <a href="<?php echo U('Index/index');?>">商城首页</a>
        <a href="<?php echo U('Cart/index');?>">购物车</a>
        <a href="<?php echo U('Customer/index');?>">会员中心</a>
    </p>

    <dl>
        <dt><a href="javascript:void(0);"><img class="img-responsive" src="/Public/assets/home/images/favicon.ico"
                                               alt="长乐美食城"/></a></dt>
        <dd><a href="javascript:void(0);">武汉长乐未央网络科技有限公司提供技术支持</a></dd>
    </dl>
</div>

<script type="text/javascript" src="/Public/assets/home/js/jquery.min.js"></script>
<script type="text/javascript" src="/Public/vendor/slick/slick.js"></script>
<script type="text/javascript" src="/Public/assets/home/js/index.js"></script>

    <script type="text/javascript" src="/Public/assets/home/js/all.js"></script>
    <script>
        $(function () {
            var nStart = 2;
            $('#loadMore').click(function () {
                var _this = $('.products');
                if (nStart >= "<?php echo ($total); ?>") {
                    $(".more").text('没有数据了亲..');
                    $('#loadMore span').removeClass("success");
                    return false;
                } else {

                    $.post("<?php echo U('Index/getMore');?>", {page: nStart}, function (data) {
                        $.each(data, function (i, item) {
//                            console.log(item['id']);return;
//                            var product_id = item['id'];
//                            console.log(product_id);return;
                            _this.append('<dl>' +
                                '<dt><a href="/Home/Index/show/id/' + item.id + '"><img class="img-responsive"' +
                                'src="' + item.thumb + '"' +
                                'alt="商品图片" style="width: 152px;height: 92px;"/></a></dt>' +
                                '<dd><a href="#">' + item.name + '</a><span>已售 12</span></dd>' +
                                '<dd class="label">库存 ' + item.stock + '</dd>' +
                                '<dd>¥ ' + item.price + '元</dd>' +
                                '</dl>');
                        });
                    });
                    nStart += 2;
                    $('#loadMore span').removeClass("success");
                }

            })
        })
    </script>

</body>
</html>